package com.itheima.controller;

import com.itheima.entity.Dish;
import com.itheima.entity.Orders;
import com.itheima.jsonresult.JsonResult;
import com.itheima.service.DishService;
import com.itheima.service.OrdersService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/order")
public class OrdersController {

    @Autowired
    private OrdersService ordersService;

    /**
     * 修改订单状态
     * @param
     * @param
     * @return
     */
    @PutMapping
    public JsonResult status(@RequestBody Orders orders) {
        return ordersService.status(orders);
    }


    /**
     * 订单分页查询
     * @param beginTime
     * @param endTime
     * @param number
     * @param page
     * @param pageSize
     * @return
     */
    @GetMapping("/page")
    public JsonResult getPage(String beginTime,String endTime,String number, @RequestParam(defaultValue = "1") Integer page, @RequestParam(defaultValue = "10") Integer pageSize){
        return ordersService.getPage(beginTime,endTime,number,page,pageSize);
    }





}
